package org.scirp.ijmis.action.personpaper;

import java.io.File;
import java.io.InputStream;

import com.opensymphony.xwork2.ActionSupport;

public class DownLoadAction extends ActionSupport {

	protected String realPath = "";

	protected String contentType = "";

	protected String filename;

	public String getRealPath() {
		return realPath;
	}

	public void setRealPath(String realPath) {
		this.realPath = realPath;
	}

	public String getContentType() {
		return contentType;
	}

	public void setContentType(String contentType) {
		this.contentType = contentType;
	}

	public String getFilename() {
		return filename;
	}

	public void setFilename(String filename) {
		this.filename = filename;
	}

	public InputStream getInputStream() throws Exception {
		return new java.io.FileInputStream(realPath + "/" + filename);
	}

	public String execute() throws Exception {
		String realFilePath = realPath + "/" + filename;
		File downFile = new File(realFilePath);
		if (downFile.exists()) {
			return SUCCESS;
		} else
			return INPUT;
	}

}
